package com.lanou.musicbox.custom;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by dllo on 15/11/2.
 */
public class MySharedMessage {

    public static void saveMessage(Context context, String key, String myValue) {
        SharedPreferences sp = context.getSharedPreferences(key,0);
        sp.edit().putString(key, myValue).commit();
    }

    public static String getMessage(Context context, String key) {
        SharedPreferences sp = context.getSharedPreferences(key, 0);
        return sp.getString(key, " ");
    }

    public static void killZhaoBaoLong(Context context, String key ) {
        SharedPreferences sp = context.getSharedPreferences(key, 0);
        sp.edit().clear().commit();
    }

    public static void putValue(Context context, String classify, String key, String value) {
        SharedPreferences sp = context.getSharedPreferences(classify, 1);
        sp.edit().putString(key, value).commit();
    }

    public static String getValue(Context context, String classify, String key, int mode) {
        SharedPreferences sp = context.getSharedPreferences(classify, 1);
        return sp.getString(key, "");
    }
//boolean类型
    public static void putBoolean(Context context, String clsaaify, String key, boolean valuer) {
        SharedPreferences sp = context.getSharedPreferences(clsaaify, 0);
        sp.edit().putBoolean(key, valuer).commit();
    }

    public static boolean getBolean(Context context, String clsaaify, String key) {
        SharedPreferences sp=context.getSharedPreferences(clsaaify,0);
        return  sp.getBoolean(key,false);
    }



}
